home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5399 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: ix.netcom.com!netnews
  2. From: miker3@ix.netcom.com (Mike Rubenstein)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: pInt = new int [987654321L], what will happen ?
  5. Date: Sun, 04 Feb 1996 08:30:35 GMT
  6. Organization: Netcom
  7. Message-ID: <31146e4c.197257088@nntp.ix.netcom.com>
  8. References: <Pine.SOL.3.91.960203215559.25805E-100000@hamlet.uncg.edu>
  9. NNTP-Posting-Host: ix-dc6-02.ix.netcom.com
  10. X-NETCOM-Date: Sun Feb 04 12:30:09 AM PST 1996
  11. X-Newsreader: Forte Agent .99c/16.141
  12.  
  13. "QIAN . ZHONG" <q_zhong@hamlet.uncg.edu> wrote:
  14.  
  15. > Hi, folks:
  16. > Here is a question about new, the following is my code:
  17. > int main(void)
  18. > {
  19. >     int *pInt;
  20. >     long Block = 987654321L;
  21. >     pInt = new int[Block];
  22. >     if(pInt == NULL) dosomething();
  23. > }
  24. > My problem is when I compile the program for DOS under large memory 
  25. > model, above new nerve return NULL, I guess compiler convert
  26. > new int[987654321L] --- convert --> new int[ ACONST]
  27. > where ACONST = 0xffff , or ACONST = 0x7fff, am I right ?
  28. > Is this a DOS thing ? or a C++ thing ? Is this portable ?
  29.  
  30. More likely the system just doesn't have 987 meg free memory, so it
  31. can't do the allocation.  Newer compilers will throw an exception, but
  32. older ones simply return the null pointer.
  33.  
  34.  
  35. Michael M Rubenstein
  36.